<script>
var _siteUrl = '<?php echo  Yii::app()->params['siteUrl']?>';
</script>
<?php
/* @var $this TransferController */
/* @var $model Transfer */
Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . "/global/js/pages/transfer.js");
Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . "/global/js/plugins/jquery-ui-1.8.16.custom.min.js");
Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . "/global/js/plugins/jquery-ui-timepicker-addon.js");
$this->breadcrumbs=array(
	'部门调动',
	'新建调动'=>array('transfer/create'),
);

?>
<script>
$(function() {
	$('#effective_time').datepicker({
		dateFormat: 'yy-mm-dd'
	});
});

</script>

<span class="page_h3">新建调动</span>

<div class="detail_div">
	<br />
	<div id="notice" style=" <?php if ($error != 0) { ?> display:block;<?php  } else {?> display:none; <?php } ?>">
    <? if ($error == 2) {
			echo '请选择新部门！';
		} else if($error == 3) {
			echo '请选择调动的元素！';
		} else if($error == 1) {
			echo '请填写调动说明！';
		} else if($error == 4) {
			echo '请填写生效时间！';
		}
	?>
    </div>
    <div class="form">
    	<form name="c_form" id="c_form" action="<?php echo Yii::app()->request->baseUrl.'/transfer/create'; ?>" method="post">
        <table cellpadding="1" cellspacing="1" class="c_table">
        	<tr>
            	<td align="right" class="td-blue">部门*：</td>
                <td >
				<?php
                $udArray = array();
                foreach($ud as $v) {
                    $udArray[$v->id] = str_repeat('  ',$v->level). $v->name;	
                }
                echo CHtml::dropDownList('userDepartment' ,'0' ,$udArray ,array('onchange'=>'transfer.getUsersByDepartment()','class'=>'c_select'));
                ?>
        		</td>
            </tr>
            <tr>
            	<td align="right" class="td-blue">选择调动的元素*：</td>
                <td><div id="department-user-div" style="padding-left:0px; margin-top:5px;"></div></td>
            </tr>
            <tr>
                <td width="130"  align="right" class="td-blue">调动说明*：</td>
                <td> <textarea class="c_textarea" id="form_note" name="form_note"></textarea> </td>
            </tr>
            <tr>
                <td  align="right" class="td-blue">原 部 门*：</td>
                <td id="old_department"> </td>
            </tr>
            <tr>
                <td  align="right" class="td-blue">新 部 门*：</td>
                <td id="new_department"> 
                <?php
				$flArray = array(0=>'--- 请选择 ---');
				foreach($firstLevel as $v) {
					$flArray[$v->id] = $v->name;	
				}
				echo CHtml::dropDownList('level_1' ,'0' ,$flArray ,array('onchange'=>'transfer.getChildren("1")','class'=>'c_select'));
				?>
                </td>
            </tr>
            <tr>
                <td  align="right" class="td-blue">审核流程：</td>
                <td id="transfer_process"> </td>
            </tr>
            <tr>
                <td  align="right" class="td-blue">生效时间*：</td>
                <td> <input type="text" autocomplete="off" name="effective_time" id="effective_time" class="c_text" /></td>
            </tr>
            <tr>
                <td colspan="2" align="center" > 
                <input type="hidden" name="form_old_department" id="form_old_department" value="0" />
                <input type="hidden" name="form_new_department" id="form_new_department" value="0" />
                <input type="hidden" name="transfer_uids" id="transfer_uids" value="" />
                <input type="hidden" value="<?php echo Yii::app()->request->csrfToken; ?>"  name="YII_CSRF_TOKEN" /><input type="submit" class="c_button" id="form_submit" value="发起调动" />  <input type="button" class="c_button" onclick="javascript:history.go(-1);" value=" 返 回 " />
                </td>
            </tr>
        </table>
        </form>
    </div><!-- form -->
	<br />
</div>